Search

現在主要的 Style guide 有 StandardJS, Airbnb, Google 三家<...

  • Share this:

現在主要的 Style guide 有 StandardJS, Airbnb, Google 三家
我自己雖然偏好 Standard 但現在也轉向其它兩家 (懶得加分號啊~)
這裡列出 Google Style Guide 的一些特色

- 使用兩個空白 (別用四個空白或 tab)。
- 請記得加入分號。
- 先別用 ES6 module export,因為語意尚未完全定義。
- 別使用 var,改使用 let, const。
- 盡可能使用 arrow function。
- 使用 template String,並且大括號內部變數不需要額外空白如: `${variable}`。
- const 所宣告的變數使用全大寫。
- 字串使用單引號。

介紹: https://goo.gl/5RufGG
Google JavaScript Style Guide:
https://google.github.io/styleguide/jsguide.html


Tags:

About author
not provided
嗨,大家好 我是卡斯伯 同時具有設計師、工程師、打雜的身份 因為角色混亂,所以開一個粉絲團來亂貼文
View all posts